Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional
fieldsselection topull_request_readfor theget_reviewsandget_check_runsmethods, allowing callers to request only the response fields they need.Omitting
fields, or passing an empty array, preserves the existing full response.Why
pull_request_readcurrently returns the full payload for every method, even when callers only need a small subset of the data.This is particularly expensive for:
get_reviews, where review bodies can contain several KB of markdown even when the caller only needs review state and reviewer information.get_check_runs, where callers often only need fields such as check name and conclusion.This addresses the high-volume cases described in #3286 while keeping response filtering opt-in and backward-compatible with the existing
fieldsbehavior elsewhere in the server.Unlike the issue's suggested default omission of review bodies, this PR does not change the default response shape: existing callers continue to receive the full response unless they explicitly request a subset of fields.
Refs #3286
get_filesis intentionally not included because #3242 already implements field selection for that method.What changed
Added an optional
fieldsparameter to the consolidatedpull_request_readschema.Added selectable fields for:
get_reviewsget_check_runsAdded method-aware validation so fields valid for one method cannot be used with another.
Validation happens before any GitHub API request is made.
Reused the existing response-field filtering helpers and fields telemetry.
Preserved
total_countwhen filtering individualget_check_runsentries.Kept lockdown filtering ahead of response projection for pull request reviews.
Preserved existing IFC labeling behavior.
Added regression coverage for schema, filtering, validation, telemetry, lockdown composition, and IFC labels.
Updated the generated tool snapshot and README documentation.
Because
pull_request_readis a consolidated tool, its JSON schema exposes the union of selectable fields for the supported methods. Runtime validation then narrows that set according to the selected method.The per-method field enums are also used to derive the schema union, keeping the advertised schema and runtime validator from drifting apart.
MCP impact
Adds the optional
fieldsparameter forpull_request_readwhen usingget_reviewsorget_check_runs.Existing calls without
fields, including calls with an emptyfieldsarray, retain the previous full response.Example:
{ "method": "get_reviews", "owner": "owner", "repo": "repo", "pullNumber": 42, "fields": ["state", "user"] }returns only the selected fields for each review.
Similarly:
{ "method": "get_check_runs", "owner": "owner", "repo": "repo", "pullNumber": 42, "fields": ["name", "conclusion"] }keeps the response envelope, including
total_count, while filtering each check run.Prompts tested (tool changes only)
Representative workflows covered by the implementation and regression tests:
“Show the review states and reviewers for this pull request without review bodies.”
get_reviewswithfields: ["state", "user"].“Show only the check names and conclusions for this pull request.”
get_check_runswithfields: ["name", "conclusion"].Existing calls without
fields.Invalid cross-method selections.
get_reviewswithfields: ["name"]is rejected before making a GitHub API request.Security / limits
This change only removes unrequested fields from responses; it does not expose any data that was previously unavailable.
For
get_reviews, lockdown filtering continues to run before response field filtering. Tests also verify that IFC metadata remains unchanged when projection is enabled.The existing low-cardinality fields telemetry is reused with
tool=pull_request_read; no new telemetry dimensions are introduced.Tool renaming
I am renaming tools as part of this PR
deprecated_tool_aliases.goI am not renaming tools as part of this PR
Lint & tests
./script/lint./script/testAdditional verification:
Docs
The
pull_request_readtool documentation now describes the optionalfieldsparameter and its supported methods.